package com.lian.controller;


import com.github.pagehelper.PageInfo;
import com.lian.pojo.PageBean;
import com.lian.pojo.Policy;
import com.lian.pojo.Result;
import com.lian.service.PolicyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lsx
 * @since 2024-04-30
 */
@RestController
@RequestMapping("/policy")
public class PolicyController {
    @Autowired
    PolicyService policyService;
    @GetMapping("/select")
    @CrossOrigin(origins = "*")
    public Result selectAll(@RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "10") Integer pageSize,String name, String document,String organ,String text,String type){
        PageBean pageBean =policyService.selectAll(page,pageSize,name,document,organ,text,type);
        return Result.success(pageBean);
    }
    //在使用变量作为路径参数进行查询时，需要加上注解@PathVariable
    @GetMapping("/getText/{id}")
    @CrossOrigin(origins = "*")
    public Result getText(@PathVariable Long id){
        String todayText=policyService.getText(id);
        return Result.success(todayText);
    }


}

